<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="-1">
<title>findGame</title>

<link rel="stylesheet" type="text/css" href="jquery-ui.min.css">
<link rel="stylesheet" type="text/css"
	href="jquery-easyui-1.4.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="jquery-easyui-1.4.1/themes/icon.css">
<script type="text/javascript" src="jquery-1.6.min.js"></script>
<script type="text/javascript"
	src="jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
<style type="text/css">
.easyui-layout {
	padding: 0;
	margin: 0;
}

.datagrid-header-row {
	height: 40px;
}

.datagrid-cell {
	font-size: 20px;
}

.FormTextTitle {
	color: #666666;
	line-height: 19px;
	overflow: hidden;
	width: 100px;
	text-align: right
}
</style>
</head>
<body>

	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north'" style="height:50px">
			<div class="span12">
				<h1 class="text-center">findGame</h1>
			</div>
		</div>
		<div data-options="region:'west',split:true" title=""
			style="width:200px;" draggable="false">
			<div style="margin-left: 10px;margin-top: 20px;"><h4>类别名称:</h4></div>
    <select id="gameStype" class="combobox"name="state" style="width:150px;margin-left: 10px;" >
	</select>

		</div>
		
	</div>
	<script type="text/javascript">
		var width = document.body.clientWidth - 165;
		var height = document.body.clientHeight;
		
		
	
		$(document).ready(function() {
			//获取表格数据url
		
		
			$("#videoList").datagrid({
				fitColumns : true,
				pagination : true,
				pageSize : 20,
				pageList: [20, 30, 40, 50, 400],
				rownumbers : true,
				width : width,
				height : document.body.clientHeight - 200,
				singleSelect : false,
				method : 'get',
				url:url,
				rownumbers : true,
				onSelect:function(ri,rd){
								
				},
				onUnselect:function(ri,rd){
					
				},
				onSelectAll:function(rows){
				
				},
				onUnselectAll:function(rows){
				
					
				},
				
				columns : [[{
					field : 'ck',
					checkbox : true
				}, {
					field : 'id',
					title : 'ID',
					width : width * 0.1,
					sortable: true,
					align : 'center'
				}, {
					field : 'name',
					title : '名称',				   
					
					width : width * 0.1,
					align : 'center'
				}, {
					field : 'isAdded',
					editor: {
		                type: 'combobox',
		                options: {
		                   value:[0,1]
		                }
		            },
					title : '是否已添加',
					width : width * 0.1,
					
					align : 'center'
				}
				]]
			});
			$('#gameStype').combobox({
				url:'getGameType?channelId='+channelId,
				valueField:'id',
				textField:'text',
			    onLoadSuccess: function () { //加载完成后,设置选中第一项
	            var val = $(this).combobox("getData");
	            if(password == '123456')
	            $("#videoList").datagrid('hideColumn','factcpmoney');
	            for (var item in val[0]) {
	            if (item == "id") {
	                        $(this).combobox("select", val[0][item]);
	                        games = $('#gameStype').combobox('getValue');
	                       
	                        $.ajax({
	            	              type: "post", //以post方式与后台沟通
	            	              url :"getHidden?channelId="+channelId+"&appkey="+games, 
	            	              dataType: "text",
	            	              success: function(json){
           
	            	              arrayObj = json.split(",");
	            	             
	            	              for (var item in arrayObj)
	            	            	  {
	            	            	  if(password == '123456')
	            	            	     $("#videoList").datagrid('hideColumn',arrayObj[item]);
	            	            	  else
	            	            		  {
	            	            		  if(arrayObj[item]=='install')
	            	            		  $("#installid").attr("checked", true);
	            	            		  if(arrayObj[item]=='totalmoney')
		            	            		  $("#totalmoneyid").attr("checked", true);
	            	            		  if(arrayObj[item]=='arpu')
		            	            		  $("#arpuid").attr("checked", true);
	            	            		  if(arrayObj[item]=='totalrevenue')
		            	            		  $("#totalrevenueid").attr("checked", true);
	            	            		  if(arrayObj[item]=='channelmoney')
		            	            		  $("#channelmoneyid").attr("checked", true);
	            	            		  if(arrayObj[item]=='cpmoney')
		            	            		  $("#cpmoneyid").attr("checked", true);
	            	            		  $("#videoList").datagrid('hideColumn',arrayObj[item]);
	            	            		  }
	            	            	  }
	            	            
	            	              }
	            	          });
	                    }
	                }
	           
	            },
				onChange: function (n,o) {
				      games = n;
					  url="getData?channelId="+channelId+"&quZhan="+quzhanv+"&password="+password+"&ji="+jiv+"&appkey="+games;
		 
					  $("#videoList").datagrid('options').url=url;
					  $("#videoList").datagrid('reload');

					   $("#TsumInstall").val(0);
					   $("#Ttotalmoney").val(0);
					    $("#Tarup").val(0);
						$("#Ttotalrevenue").val(0);
						$("#Tchannelmoney").val(0);
						$("#Tcpmoney").val(0);
						$.ajax({
					             type: "GET",
					             url: "getCan?channelId="+channelId+"&appkey="+games,				             
					             dataType: "text",
					             success: function(data){
					                        var jiuv = data.split(",")[0];
					                        var biuv = data.split(",")[1];               
					                        $("#quZhan").numberbox("setValue",biuv);					                       
					                        $('#selectji').combobox('setValue',jiuv)
					                        if(password!="123456"){
					                        $('#installcoeff').val(data.split(",")[2]);
					                        $('#totalmoneycoeff').val(data.split(",")[3]);
					                        $('#coeffbase').val(data.split(",")[4]);
					                        }				             
					                      }
					         });
						
					  }
				}); 
		
			//$('#videoList').datagrid('hideColumn', 'cpmoney');
			
		});
		
		 //$("#videoList").datagrid('hideColumn','cpmoney'); 
		
		
	</script>

</body>
</html>